﻿using System.Configuration.Provider;
using NCMIS.AccessControl;
using NCMIS.Produce;

namespace NCMIS.Provider
{
    /// <summary>
    /// Provides the base implementation for the ACL Provider for the ACL Services.
    /// </summary>
    public abstract class AclProviderBase : ProviderBase
    {
        /// <summary>
        /// When implemented in a derived class, gets the ACL currently applied to the specified document or folder object.
        /// </summary>
        /// <param name="repositoryId">The id of the repository.</param>
        /// <param name="objectId">The id of the object.</param>
        /// <param name="onlyBasicPermissions">If true only the basic permissions (cmis:read, cmis:write and cmis:all) will be applied.</param>
        /// <returns>List of access control entries of the ACL for the object.</returns>
        public abstract Acl GetAcl(string repositoryId, string objectId, bool onlyBasicPermissions);

        /// <summary>
        /// When implemented in a derived class, adds or removes the given ACEs to or from the ACL of document or folder object.
        /// </summary>
        /// <param name="repositoryId">The id of the repository.</param>
        /// <param name="objectId">The id of the object.</param>
        /// <param name="addACEs">The ACEs to add.</param>
        /// <param name="removeACEs">The ACEs to remove.</param>
        /// <param name="aclPropagation">Specifies how ACEs should be handled.</param>
        /// <returns>List of access control entries of the resulting ACL for the object.</returns>
        public abstract Acl ApplyAcl(string repositoryId, string objectId, AccessControlList addACEs, AccessControlList removeACEs, AclPropagation aclPropagation);
    }
}
